<script setup lang="ts">
import {reactive} from 'vue';
import {addCompany} from "@/apis";
import {Message} from "@arco-design/web-vue";

const form = reactive({
  name: '',
  description: '',
  industry: '',
  location: '',
  website: '',
});
const handleSubmit = async (form) => {
  console.log(form);
  const res = await addCompany(form);
  if (res.code === 200) {
    Message.success('注册成功，请等待审核');
  } else {
    Message.error(res.msg);
  }
};

const getContent = (value: string) => {
  form.description = value;
};
</script>

<template>
  <div class="table-page">
    <h1 style="margin: 0 auto">注册企业</h1>
    <a-form :model="form" :style="{ width: '1000px' }" @submit="handleSubmit" style="margin: 10px auto 0;">
      <a-form-item field="name" label="企业名称">
        <a-input
            v-model="form.name"
            placeholder="请输入企业名称"
        />
      </a-form-item>
      <a-form-item field="description" label="企业描述">
<!--        <a-textarea v-model="form.description" placeholder="请输入企业描述"/>-->
        <AiEditor @content="getContent" style="height: 400px" />
      </a-form-item>
      <a-form-item field="industry" label="行业类型">
        <a-input v-model="form.industry" placeholder="请输入行业类型"/>
      </a-form-item>
      <a-form-item field="location" label="公司地址">
        <a-input v-model="form.location" placeholder="请输入公司地址"/>
      </a-form-item>
      <a-form-item field="website" label="网站地址">
        <a-input v-model="form.website" placeholder="请输入网站地址"/>
      </a-form-item>
      <a-form-item>
        <a-button html-type="submit">提交</a-button>
      </a-form-item>
    </a-form>
  </div>
</template>

<style scoped lang="scss">

</style>